#include "Message.P2.AddOrder.h"

namespace AlgoTrading
{
	namespace Messages
	{
		P2AddOrder::P2AddOrder(void)
			: RequestWithoutResponse(std::auto_ptr<PBClientMessage>(new PBClientMessage()))
		{
			addOrder = requestWithoutResponse->MutableExtension(PBP2AddOrder::requestWithoutResponse);
			requestWithoutResponse->set_type(PBRequestWithoutResponse_Type_PBP2AddOrder);
		}

		P2AddOrder::~P2AddOrder(void)
		{
		}

		P2AddOrder::P2AddOrder(std::auto_ptr<PBClientMessage>& message)
			: RequestWithoutResponse(message)
		{
			addOrder = requestWithoutResponse->MutableExtension(PBP2AddOrder::requestWithoutResponse);
		}


		void P2AddOrder::SetOrderUniqueId(::google::protobuf::string& orderUniqueId)
		{
			addOrder->set_orderuniqueid(orderUniqueId);
		}

		::google::protobuf::string P2AddOrder::GetOrderUniqueId() const
		{
			return addOrder->orderuniqueid();
		}

		void P2AddOrder::SetOrderType(P2AddOrder::OrderType type)
		{
			return addOrder->set_type(static_cast<PBP2AddOrder_OrderType>(type));
		}

		P2AddOrder::OrderType P2AddOrder::GetOrderType() const
		{
			return static_cast<P2AddOrder::OrderType>(addOrder->type());
		}

		void P2AddOrder::SetOrderAmount(::google::protobuf::int32 amount)
		{
			addOrder->set_amount(amount);
		}

		::google::protobuf::int32 P2AddOrder::GetOrderAmount() const
		{
			return addOrder->amount();
		}

		void P2AddOrder::SetOrderPrice(double price)
		{
			addOrder->set_price(price);
		}

		double P2AddOrder::GetOrderPrice() const
		{
			return addOrder->price();
		}

		void P2AddOrder::SetSequrity(::google::protobuf::string& security)
		{
			addOrder->set_security(security);
		}

		::google::protobuf::string P2AddOrder::GetSequrity() const
		{
			return addOrder->security();
		}

		RequestWithoutResponse::RequestWithoutResponseMessageType P2AddOrder::GetRequestWithoutResponseMessageType() const
		{
			return RequestWithoutResponse::ADD_ORDER;
		}
	}
}
